export let randomData = function () {
    let DataList = []
    for (let i = 30; i > 0; i--) {
        let obj = {
            name: filterDate(i),
            value: Math.floor(Math.random() * 10)
        }
        DataList.push(obj)
    }
    return DataList;
}


function filterDate(n: number) {
    let value = Number(new Date())
    let day = 60 * 60 * 24 * 1000 * n
    const dt = new Date(value - day)
    const y = dt.getFullYear()
    const m = (dt.getMonth() + 1 + '').padStart(2, '0')
    const d = (dt.getDate() + '').padStart(2, '0')
    return `${m}${"-"}${d}`
}

interface dataType {
    name:string,
    value:number
}

export let randomData2 = function () {
    const data: dataType[] = [];
    const nameData:string[] = ['A', 'B', 'C', 'D', 'E']
    for (let i = 0; i < 5; ++i) {
        data.push({
            name:nameData[i],
            value:Math.round(Math.random() * 200)
        });
    }
    return data
}